<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');  
class Test_model extends CI_Model
{
	public function __construct()
	{
		parent::__construct();
	}

	function get_test()
	{
		// 		$this->db->order_by('titulo', 'asc');
		// 		$query = $this->db->get('tb_perguntas', 10, 20);
		$table_row_count = $this->db->count_all('tb_perguntas');

		if ($table_row_count > 0)
		{
			return $table_row_count;
		}
		else
		{
			return -1;
		}
	}
	function find(){
		$query = $this->db->query("SELECT * FROM tb_perguntas WHERE id < 50");
		if ($query->num_rows() > 0)
		{
			return $query->result();

		} else {
			return -1;
		}
	}
}
?>